<template>
  <div class="common_header">
    <div class="select_sys">
      <el-select v-model="value1" size="small" clearable placeholder="请选择">
        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
      </el-select>
      <el-select v-model="value2" size="small" clearable placeholder="请选择" style="margin-left: 10px;">
        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
      </el-select>
    </div>
    <div class="heade_user">
      <el-badge is-dot class="item header_icon">
        <i class="el-icon-message-solid"></i>
      </el-badge>
      <i class="el-icon-switch-button header_icon" @click="logOut"></i>
      <span class="user_name">
        <el-avatar class="user_avatar" size="small" :src="adminAvatar" fit="cover" @error="errorHandler"></el-avatar>
        张三
      </span>
    </div>
  </div>
</template>

<script>
import adminAvatar from '@/assets/img/logo.png';

export default {
  name: "Header",
  data() {
    return {
      options: [{
        value: '选项1',
        label: '黄金糕'
      }, {
        value: '选项2',
        label: '双皮奶'
      }, {
        value: '选项3',
        label: '蚵仔煎'
      }, {
        value: '选项4',
        label: '龙须面'
      }, {
        value: '选项5',
        label: '北京烤鸭'
      }],
      value1: '',
      value2: '',
      adminAvatar
    }
  },
  methods: {
    errorHandler() {
      return true
    },
    // 退出登录
    logOut () {
      this.$confirm('确定退出登录吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        center: true
      }).then(() => {
        window.sessionStorage.clear();
        this.$router.push({ name: "login" });
      }).catch(() => {
        console.log("已取消");
      });
    }
  }
}
</script>

<style lang="less" scoped>
@import "./Header.less";
</style>

